/*
 * @Author: WangShuai 1830773767@qq.com
 * @Date: 2025-05-29 08:32:56
 * @LastEditors: WangShuai 1830773767@qq.com
 * @LastEditTime: 2025-05-29 14:28:27
 * @FilePath: \guanggu_traffic\src\stores\user.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import {
    ref,
    reactive
} from "vue";
import {
    defineStore
} from "pinia";
export const useUserDataStore = defineStore("user", () => {
    const getLocalStorage = () => {
        const res = {
            username: "",
            password: "",
            type: "common",
        };
        res.username = localStorage.getItem('username')|| "";
        res.type = localStorage.getItem("type") || "common";
        return res
    }
    const userData = reactive(getLocalStorage());
    const handleType = (value) => {
        userData.type = value;
    }
    return {
        userData,
        handleType
    }
})